<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //编写一个Student构造函数
        function Student(name,age){
            this.name = name;
            this.age = age;
            this.say = function(){
                console.log('我叫'+ this.name +'，今年'+ this.age);
            };
        }
        //使用Student构造函数创建对象
        var stu1 = new Student('小杨',18);
        console.log(stu1.name);
        console.log(stu1.say());

        var stu2 = new Student('小王',16);
        console.log(stu2.name);
        console.log(stu2.say());
    </script>
    </head>
<body>
    
</body>
</html>